

#include "ChaosVector2.hpp"



namespace Chaos
{

	ChsVector2::ChsVector2()
	{
		m_fX = 0.0f;
		m_fY = 0.0f;
	}

	ChsVector2::ChsVector2(const float *vec)
	{
		m_fX = vec[0];
		m_fY = vec[1];
	}

	ChsVector2::ChsVector2(const float& x,const float& y)
	{
		m_fX = x;
		m_fY = y;
	}

	ChsVector2::ChsVector2(const ChsVector2& vec)
	{
		m_fX = vec.m_fX;
		m_fY = vec.m_fY;
	}


	ChsVector2&	ChsVector2::operator += (const ChsVector2& vec)
	{
		m_fX +=vec.m_fX;
		m_fY +=vec.m_fY;
		return *this;
	}
	ChsVector2&	ChsVector2::operator -= (const ChsVector2& vec)
	{
		m_fX -=vec.m_fX;
		m_fY -=vec.m_fY;
		return *this;
	}
	ChsVector2&	ChsVector2::operator *= (const float& scale)
	{
		m_fX *=scale;
		m_fY *=scale;
		return *this;
	}
	ChsVector2&	ChsVector2::operator /= (const float& scale)
	{
		m_fX /=scale;
		m_fY /=scale;
		return *this;
	}

	ChsVector2	ChsVector2::operator + (const ChsVector2& vec)const
	{
		ChsVector2 result;
		result.m_fX = m_fX + vec.m_fX;
		result.m_fY = m_fY + vec.m_fY;
		return result;
	}
	
	ChsVector2	ChsVector2::operator - (const ChsVector2 & vec)const
	{
		ChsVector2 result;
		result.m_fX = m_fX - vec.m_fX;
		result.m_fY = m_fY - vec.m_fY;
		return result;
	}

	ChsVector2	ChsVector2::operator * (const float & scale)const
	{
		ChsVector2 result;
		result.m_fX = m_fX * scale;
		result.m_fY = m_fY * scale;
		return result;
	}
	ChsVector2	ChsVector2::operator / (const float & scale)const
	{
		ChsVector2 result;
		result.m_fX = m_fX / scale;
		result.m_fY = m_fY / scale;
		return result;
	}


	ChsVector2&	ChsVector2::operator = (const ChsVector2 & vec)
	{
		m_fX = vec.m_fX;
		m_fY = vec.m_fY;
		return *this;
	}

	/*
	void ChsVector2::Normalize()
	{
		if( m_fX!=0 || m_fY!=0 )
		{
			float len = 1 / Length();
			m_fX *= len;
			m_fY *= len;
		}
	}

	ChsVector2	ChsVector2::Cross(const ChsVector2 &vec1,const ChsVector2 &vec2)
	{
		ChsVector2 result;
		result.m_fX = vec1.m_fY * vec2.m_fZ - vec2.m_fY * vec1.m_fZ;
		result.m_fY = vec1.m_fZ * vec2.m_fX - vec2.m_fZ * vec1.m_fX;
		result.m_fZ = vec1.m_fX * vec2.m_fY - vec2.m_fX * vec1.m_fY;
		return result;
	}

	float	ChsVector2::Dot(const ChsVector2 &vec1,const ChsVector2 &vec2)
	{
		return vec1.m_fX * vec2.m_fX + vec1.m_fY * vec2.m_fY + vec1.m_fZ * vec2.m_fZ;
	}

	float ChsVector2::Length()
	{
		return sqrtf(LengthSQ());
	}

	float ChsVector2::LengthSQ()
	{
		return m_fX * m_fX + m_fY * m_fY + m_fZ * m_fZ;
	}
*/

}

